Reflection Time:
This is a place to journal your experience of completing this project. This will help you figure out how to improve as a developer.
Write down how you approached the project. What was hard, what was easy. How might you improve for the next project? What was your biggest learning from today? What would you do differently if you were to tackle this project again?
from tkinter import * import math # ---------------------------- CONSTANTS ------------------------------- # PINK = "#e2979c" RED = "#e7305b" GREEN = "#9bdeac" YELLOW = "#f7f5dd" FONT_NAME = "Courier" WORK_MIN = 1 timer = None # ---------------------------- TIMER RESET ------------------------------- # def reset_timer(): window.after_cancel(timer) canvas.itemconfig(timer_text, text="00:00") text_input.delete(1.0, 'end') results.config(text="") # ---------------------------- TIMER MECHANISM ------------------------------- # def start_timer(): work_sec = WORK_MIN * 60 count_down(work_sec) title_label.config(text=TEXT, fg=RED) # ---------------------------- COUNTDOWN MECHANISM ------------------------------- # def count_down(count): count_min = math.floor(count / 60) count_sec = count % 60 if count_sec < 10: count_sec = f"0{count_sec}" canvas.itemconfig(timer_text, text=f"{count_min}:{count_sec}") if count > 0: global timer timer = window.after(1000, count_down, count - 1) else: tab = get_text_input() text_input.delete(1.0, 'end') show_results(tab) # ---------------------------- UI SETUP ------------------------------- # window = Tk() window.title("Typing speed tester ") window.config(padx=150, pady=50, bg=YELLOW) canvas = Canvas(width=200, height=50, bg=YELLOW, highlightthickness=0) timer_text = canvas.create_text(100,20, text="00:00", fill=RED, font=(FONT_NAME, 35, "bold")) canvas.grid(column=1, row=0) TEXT = "It's all about how much you are discipline . Discpline is the main key of success.\n " \ "No one will see your commitment , your hard work and your discipline between people . \n" \ "That's not important because God is seeing you . God and only god ." app_tab = TEXT.split() title_label = Label(text=TEXT, fg=RED, bg=YELLOW, font=(FONT_NAME, 15)) title_label.config(pady=2) title_label.grid(column=1, row=1) #create text label text_label=Label(text='Type as you can from the text above in the box below, good luck!!', fg='blue', bg=YELLOW, font=(FONT_NAME, 13)) text_label.config(pady=40) text_label.grid(column=1, row=2) #create text box text_input = Text(window, height=5, width=100) text_input.grid(column=1, row=3) #get the text input def get_text_input(): text = text_input.get(1.0, "end-1c") text_input_tab=text.split(" ") return text_input_tab #show the results def show_results(tab): counter = 0 for item in tab : if item in app_tab: counter += 1 results.config(text=f"Your typing speed is {counter} WPM.") start_button = Button(text="Start", highlightthickness=0, command=start_timer) start_button.grid(column=0, row=2) reset_button = Button(text="Reset", highlightthickness=0, command=reset_timer) reset_button.grid(column=2, row=2) results = Label(fg=RED, bg=YELLOW) results.grid(column=1, row=4) window.mainloop()
Give Feedback
What went well? What could be improved?
Reflection Time:
This is a place to journal your experience of completing this project. This will help you figure out how to improve as a developer.
Write down how you approached the project. What was hard, what was easy. How might you improve for the next project? What was your biggest learning from today? What would you do differently if you were to tackle this project again?
ghj
Give Feedback
What went well? What could be improved?
Reflection Time:
This is a place to journal your experience of completing this project. This will help you figure out how to improve as a developer.
Write down how you approached the project. What was hard, what was easy. How might you improve for the next project? What was your biggest learning from today? What would you do differently if you were to tackle this project again?
it was typing speed test .
Give Feedback
What went well? What could be improved?